/**
 */
package de.thwildau.tm.moses.asn1.asn1.impl;

import de.thwildau.tm.moses.asn1.asn1.Asn1Package;
import de.thwildau.tm.moses.asn1.asn1.ElementSetSpec;
import de.thwildau.tm.moses.asn1.asn1.ElementSetSpecs;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Element Set Specs</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.thwildau.tm.moses.asn1.asn1.impl.ElementSetSpecsImpl#getElementSetSpec <em>Element Set Spec</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ElementSetSpecsImpl extends SubtypeConstraintImpl implements ElementSetSpecs
{
  /**
   * The cached value of the '{@link #getElementSetSpec() <em>Element Set Spec</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getElementSetSpec()
   * @generated
   * @ordered
   */
  protected EList<ElementSetSpec> elementSetSpec;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ElementSetSpecsImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return Asn1Package.Literals.ELEMENT_SET_SPECS;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<ElementSetSpec> getElementSetSpec()
  {
    if (elementSetSpec == null)
    {
      elementSetSpec = new EObjectContainmentEList<ElementSetSpec>(ElementSetSpec.class, this, Asn1Package.ELEMENT_SET_SPECS__ELEMENT_SET_SPEC);
    }
    return elementSetSpec;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case Asn1Package.ELEMENT_SET_SPECS__ELEMENT_SET_SPEC:
        return ((InternalEList<?>)getElementSetSpec()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case Asn1Package.ELEMENT_SET_SPECS__ELEMENT_SET_SPEC:
        return getElementSetSpec();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case Asn1Package.ELEMENT_SET_SPECS__ELEMENT_SET_SPEC:
        getElementSetSpec().clear();
        getElementSetSpec().addAll((Collection<? extends ElementSetSpec>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case Asn1Package.ELEMENT_SET_SPECS__ELEMENT_SET_SPEC:
        getElementSetSpec().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case Asn1Package.ELEMENT_SET_SPECS__ELEMENT_SET_SPEC:
        return elementSetSpec != null && !elementSetSpec.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //ElementSetSpecsImpl
